/**************************************************************************************************
* Title: SmurfsRigidBody.h
* Author: Gael Huber
* Description: Holds a rigid body used for physics and collision systems.
**************************************************************************************************/
#ifndef __SMURFSRIGIDBODY_H__
#define __SMURFSRIGIDBODY_H__

#include "SmurfsVector3.h"
#include "SmurfsQuaternion.h"
#include "SmurfsMatrix.h"

class RigidBody {
public:
	RigidBody(void);	// Constructor
	RigidBody(Vector3 halfWidths, float mass);	// Constructor defining dimensions
	~RigidBody(void);	// Destructor

	void init(void);	// Initialize the rigid body as a rigid body

	virtual void move(void);	// Move the rigid body according to it's particularly movement pattern
	virtual void closestPtPointOBB(Vector3 p, Vector3& q);	// Finds the point on the OBB cloest to the specified point
	void updateForces(float dt);	// Perform moment of inertia calculations

	Quaternion axes;	// Object axes
	Vector3 center;	// Position of rigid body
	Vector3 velocity;	// Velocity vector
	Vector3 halfWidths;	// Halfwidths
	float mass;		// Mass of the object

	Quaternion dQ;			// Derivative of the quaternion
	Vector3 controls[3];	// Array of three control points
	Vector3 appliedForce;	// Force applied by the "hand of god"
	Vector3 angularMomentum;	// Angular momentum
	Vector3 tAcceleration;	// Translational acceleration vector
	Vector3 aPosition;		// Angular position
	Vector3 aVelocity;		// Angular velocity
	Vector3 aAcceleration;	// Angular acceleration
	Matrix inertiaTensor;	// Moment of Inertia tensor
	Matrix worldInertiaTensor;	// MIT in world frame
	float momentOfIntertia;	// The moment of inertia for the object
};

#endif

